package com.mindata.blockchain.core.manager;

import javax.annotation.Resource;

import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.mindata.blockchain.core.model.SyncEntity;
import com.mindata.blockchain.core.repository.SyncRepository;

/**
 * @author wuweifeng wrote on 2018/3/21.
 */
@Service
public class SyncManager {
	@Resource
	private SyncRepository syncRepository;

	public SyncEntity findLastOne() {
		return syncRepository.findTopByOrderByIdDesc();
	}

	public SyncEntity save(final SyncEntity syncEntity) {
		return syncRepository.save(syncEntity);
	}

	public Object findAll(final Pageable pageable) {
		return syncRepository.findAll(pageable);
	}

	public void deleteAll() {
		syncRepository.deleteAll();
	}
}
